package com.education.teach.utils;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import com.alibaba.android.arouter.launcher.ARouter;


/**
 * Class name
 * Created by  2018/7/17 0017 16:31.
 * Author by yangjing
 */
public class ARouterUtils {

    public static void startAcitivty(String path, Context context) {
        ARouter.getInstance().build(path).navigation(context);
    }

    public static void startAcitivty(Context context, Class tClass) {
        Intent intent = new Intent(context, tClass);
        context.startActivity(intent);
    }

    public static void startAcitivty(Context context, Class tClass, Bundle bundle) {
        Intent intent = new Intent(context, tClass);
        intent.putExtras(bundle);
        context.startActivity(intent);
    }

    /**
     * 通过Class跳转界面
     **/
    public static void startActivityForResult(Activity activity, Class<?> cls, int requestCode) {
        startActivityForResult(activity, cls, null, requestCode);
    }

    /**
     * 含有Bundle通过Class跳转界面
     **/
    public static void startActivityForResult(Activity activity, Class<?> cls, Bundle bundle,int requestCode) {
        Intent intent = new Intent();
        intent.setClass(activity, cls);
        if (bundle != null) {
            intent.putExtras(bundle);
        }
        activity.startActivityForResult(intent, requestCode);
    }

}
